<html>
<body>

<div>
  <input id="code" placeholder="验证码" type="text" class=""
         style="width:170px">
  <!-- 验证码 显示 -->
  <img οnclick="javascript:getvCode()" id="verifyimg" style="margin-left: 20px; margin-top: 10px"/>
</div>

<script type="text/javascript">
  getvCode();

  /**
   * 获取验证码
   * 将验证码写到login.html页面的id = verifyimg 的地方
   */
  function getvCode() {
    document.getElementById("verifyimg").src = timestamp("/webapi/verifycode/querycode");
  }
  //为url添加时间戳
  function timestamp(url) {
    var getTimestamp = new Date().getTime();
    if (url.indexOf("?") > -1) {
      url = url + "&timestamp=" + getTimestamp
    } else {
      url = url + "?timestamp=" + getTimestamp
    }
    return url;
  };
</script>
</body>

</html>